<%@page import="com.topisv.tms.service.account.ShiroDbRealm.ShiroUser"%>
<%@page import="org.apache.shiro.SecurityUtils" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%
	ShiroUser curUser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
	String jobuuid = curUser.jobuuid ;
%>
<script type="text/javascript">
	//5000为1秒钟setInterval("getNotice()",5000);
	var jobuuid = '<%=jobuuid %>' ;
	/* $.ajax({
		   type : 'post',
			url : '${ctx}/notice/ajaxGetNotice',
			data : {
				jobuuid:jobuuid
			},
			dataType : 'json',
			success : function(data) {
			   if(null != data.status&&data.status=="no"){
				   if(null == data.notice){
					   $("#notice_div").removeAttr("style") ;
				   }else{
					   $("#notice_title_a").html("<a href=\"#detail_notice\" data-toggle=\"modal\" onclick=\"findNotice("+data.notice.id+")\"><font color=\"red\">"+data.notice.noticeTitle+"</font></a>") ;
					   $("#notice_title_div").show() ;
					   $("#notice_div").show();
					   $("#jobuuid").val(jobuuid) ;
				   }
			   }else{
				   $("#notice_div").removeAttr("style");
			   } 
			},
			error : function() {
				jAlert("网络繁忙，请稍后重试...","公告管理");
			}
		});  */
	function findNotice(id){
		$("#notice_div").hide();
		var jobuuid = $("#jobuuid").val() ; 
		$.ajax({
			type:'post',
			url:'${ctx}/notice/findById2/'+id,
			data:{
				id:id,
				jobuuid:jobuuid
			},
			dataType:'json',
			success:function(data) {
			    $("#noticeTitle").html(data.notice.noticeTitle) ;
				$("#noticeDes").html(data.notice.noticeDes);
				$("#notice_div").removeAttr("style");
			},
			error:function() {
				alert("网络繁忙，请稍后重试...");
			}
	   });
   }
</script>
<!-- <div style="right:800px; POSITION:absolute; top:300px;z-index:129;width:300px;height:50px;" name="notice_div" id="notice_div" > 
	<div class="btn btn-info" style="display:none;" id="notice_title_div">
		<input type = "hidden" id="jobuuid" name="jobuuid" value="" />
		<div id="notice_title_a" >
		</div>
	</div>
</div> -->
        <!-- header logo: style can be found in header.less -->
        <header class="header">
            <a href="${ctx}" class="logo"  style="overflow:hidden;">
                <!-- Add the class icon to your logo image or logo icon to add the margining -->
                 <i class="fa fa-fw fa-home"></i>
                                 风之鱼WMS
            </a>
            <!-- Header Navbar: style can be found in header.less -->
            <nav class="navbar navbar-static-top" role="navigation">
                <!-- Sidebar toggle button-->
                <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <div class="navbar-right">
                    <ul class="nav navbar-nav">
                       
                       <li class="dropdown messages-menu qq-online">
                         <a href="http://wpa.qq.com/msgrd?v=3&uin=2546403944&site=qq&menu=yes" target="_blank" >
                           <img border="0" title="联系技术支持" alt="联系技术支持" src="http://pub.idqqimg.com/wpa/images/counseling_style_51.png">
                         </a>                       </li>
                    
                        <!-- 站内信息 -->
                        <li class="dropdown messages-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="fa fa-envelope"></i>
                                <span class="label label-success" id="message_count"></span>
                            </a>
                            <ul class="dropdown-menu">
                                <li class="header">你有<b><font color=red id="message_count_red"></font></b>条<font color=blue>未读</font>站内信</li>
                                <li>
                                    <!-- inner menu: contains the actual data -->
                                    <ul class="menu" id="message_ul">
                                    
                                        <li>
                                            <a href="#">
                                                <div class="pull-left">
                                                    <img src="${ctx}/static/v2/img/avatar2.png" class="img-circle" alt="user image"/>
                                                </div>
                                                <h4>
                                                    AdminLTE Design Team
                                                </h4>
                                                <p>Why not buy a new awesome theme?</p>
                                            </a>
                                        </li>
                                        
                                    </ul>
                                </li>
                                <li class="footer"><a href="#">查看所有站内信</a></li>
                            </ul>
                        </li>
                        
                        <!-- 提醒 -->
<!--                         <li class="dropdown notifications-menu"> -->
<!--                             <a href="#" class="dropdown-toggle" data-toggle="dropdown"> -->
<!--                                 <i class="fa fa-warning"></i> -->
<!--                                 <span class="label label-warning">10</span> -->
<!--                             </a> -->
<!--                             <ul class="dropdown-menu"> -->
<!--                                 <li class="header">You have 10 notifications</li> -->
<!--                                 <li> -->
                                    <!-- inner menu: contains the actual data -->
<!--                                     <ul class="menu"> -->
<!--                                         <li> -->
<!--                                             <a href="#"> -->
<!--                                                 <i class="ion ion-ios7-people info"></i> 5 new members joined today -->
<!--                                             </a> -->
<!--                                         </li> -->
<!--                                         <li> -->
<!--                                             <a href="#"> -->
<!--                                                 <i class="fa fa-warning danger"></i> Very long description here that may not fit into the page and may cause design problems -->
<!--                                             </a> -->
<!--                                         </li> -->
<!--                                         <li> -->
<!--                                             <a href="#"> -->
<!--                                                 <i class="fa fa-users warning"></i> 5 new members joined -->
<!--                                             </a> -->
<!--                                         </li> -->

<!--                                         <li> -->
<!--                                             <a href="#"> -->
<!--                                                 <i class="ion ion-ios7-cart success"></i> 25 sales made -->
<!--                                             </a> -->
<!--                                         </li> -->
<!--                                         <li> -->
<!--                                             <a href="#"> -->
<!--                                                 <i class="ion ion-ios7-person danger"></i> You changed your username -->
<!--                                             </a> -->
<!--                                         </li> -->
<!--                                     </ul> -->
<!--                                 </li> -->
<!--                                 <li class="footer"><a href="#">View all</a></li> -->
<!--                             </ul> -->
<!--                         </li> -->
                        
                        <!-- 任务 -->
<!--                         <li class="dropdown tasks-menu"> -->
<!--                             <a href="#" class="dropdown-toggle" data-toggle="dropdown"> -->
<!--                                 <i class="fa fa-tasks"></i> -->
<!--                                 <span class="label label-danger">9</span> -->
<!--                             </a> -->
<!--                             <ul class="dropdown-menu"> -->
<!--                                 <li class="header">You have 9 tasks</li> -->
<!--                                 <li> -->
                                    <!-- inner menu: contains the actual data -->
<!--                                     <ul class="menu"> -->
<!--                                         <li>Task item -->
<!--                                             <a href="#"> -->
<!--                                                 <h3> -->
<!--                                                     Design some buttons -->
<!--                                                     <small class="pull-right">20%</small> -->
<!--                                                 </h3> -->
<!--                                                 <div class="progress xs"> -->
<!--                                                     <div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> -->
<!--                                                         <span class="sr-only">20% Complete</span> -->
<!--                                                     </div> -->
<!--                                                 </div> -->
<!--                                             </a> -->
<!--                                         </li>end task item -->
<!--                                         <li>Task item -->
<!--                                             <a href="#"> -->
<!--                                                 <h3> -->
<!--                                                     Create a nice theme -->
<!--                                                     <small class="pull-right">40%</small> -->
<!--                                                 </h3> -->
<!--                                                 <div class="progress xs"> -->
<!--                                                     <div class="progress-bar progress-bar-green" style="width: 40%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> -->
<!--                                                         <span class="sr-only">40% Complete</span> -->
<!--                                                     </div> -->
<!--                                                 </div> -->
<!--                                             </a> -->
<!--                                         </li>end task item -->
<!--                                         <li>Task item -->
<!--                                             <a href="#"> -->
<!--                                                 <h3> -->
<!--                                                     Some task I need to do -->
<!--                                                     <small class="pull-right">60%</small> -->
<!--                                                 </h3> -->
<!--                                                 <div class="progress xs"> -->
<!--                                                     <div class="progress-bar progress-bar-red" style="width: 60%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> -->
<!--                                                         <span class="sr-only">60% Complete</span> -->
<!--                                                     </div> -->
<!--                                                 </div> -->
<!--                                             </a> -->
<!--                                         </li>end task item -->
<!--                                         <li>Task item -->
<!--                                             <a href="#"> -->
<!--                                                 <h3> -->
<!--                                                     Make beautiful transitions -->
<!--                                                     <small class="pull-right">80%</small> -->
<!--                                                 </h3> -->
<!--                                                 <div class="progress xs"> -->
<!--                                                     <div class="progress-bar progress-bar-yellow" style="width: 80%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> -->
<!--                                                         <span class="sr-only">80% Complete</span> -->
<!--                                                     </div> -->
<!--                                                 </div> -->
<!--                                             </a> -->
<!--                                         </li>end task item -->
<!--                                     </ul> -->
<!--                                 </li> -->
<!--                                 <li class="footer"> -->
<!--                                     <a href="#">View all tasks</a> -->
<!--                                 </li> -->
<!--                             </ul> -->
<!--                         </li> -->

                        <!-- 当前用户信息 -->
                        <li class="dropdown user user-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="glyphicon glyphicon-user"></i>
                                <span><shiro:principal property="realname"/> <i class="caret"></i></span>
                            </a>
                            <ul class="dropdown-menu">
                                <!-- User image -->
                                <li class="user-header bg-light-blue">
                                    <img src="${ctx}/static/v2/img/avatar5.png" class="img-circle" alt="User Image" />
                                    <p>
                                        <shiro:principal property="realname"/>
                                        <small></small>
                                    </p>
                                </li>
                                <!-- Menu Body -->
                                <!--   <li class="user-body">
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Followers</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Sales</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Friends</a>
                                    </div>
                                </li>  --> 
                                <!-- Menu Footer-->
                              
                                <li class="user-footer">
                                  <shiro:hasRole name="admin">
                                    <div class="pull-left">
                                        <a href="${ctx}/v2/admin/user" class="btn btn-default btn-flat">账户管理</a>
                                    </div>
                                    </shiro:hasRole>
                                    <div class="pull-left" style="margin-left: 6px;">
                                        <a href="${ctx}/v2/profile" class="btn btn-default btn-flat">修改账户</a>
                                    </div>
                                       <div class="pull-right">
                                        <a href="${ctx}/logout" class="btn btn-default btn-flat">退出登录</a>
                                    </div>
    				
                                    
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>
        <!-- 明细窗口 -->
		<div class="modal fade"  id="detail_notice" >
			<div class="modal-dialog" style="height: 900px; width: 900px">
				<div class="modal-content"  >
		
			<!-- 头 -->
			<div class="modal-header">
				<div id="noticeTitle" align="center"></div>
			</div>
			<!-- 体 -->
			<div class="modal-body">
				<fieldset>
				      <div class="row">
							<div class="col-md-12">
				
								<!-- Primary box -->
								<div class="box box-solid box-primary" id="noticeDes">
									
								</div>
							</div>
						</div>
					</fieldset>	
			</div>
			<!-- 尾 -->
			<div class="modal-footer bg-gray">
				<input id="cancel_btn" class="btn btn-primary" type="button" data-dismiss="modal" value="返回" />
			</div>
			</div>
			</div>
	     </div>
        